package com.bear.hospital.utils;

import com.auth0.jwt.interfaces.DecodedJWT;

/**
 * @Author： zmwx
 * @Date： 2025/2/20 17:32
 * @Describe：
 */
public class JwtContext {
    private static final ThreadLocal<DecodedJWT> jwtInfo = new ThreadLocal<>();
    private static final ThreadLocal<String> userNameThredLoacl = new ThreadLocal<>();
    public static void setJwtInfo(DecodedJWT decodedJWT) {
        jwtInfo.set(decodedJWT);
    }
    public static void setUserName(String userName) {
        userNameThredLoacl.set(userName);
    }

    public static DecodedJWT getJwtInfo() {
        return jwtInfo.get();
    }
    public static String getUserName() {
        return userNameThredLoacl.get();
    }

    public static void clear() {
        jwtInfo.remove();
    }
}